package com.shudingke.utils;

import org.junit.Test;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;

public class FileNameUtils {
    public static String changeName(String oldName){
        // oldName:sdjflaskjfsajdasa
//        Date date = new Date();
//        String time = "" + date.getYear() + date.getMonth() + date.getDay() + 
//                date.getHours() + date.getMinutes() + date.getSeconds();
//        String[] split = oldName.split("$");
//        oldName = time + "." + split[split.length - 1];
        int i = oldName.lastIndexOf(".");
        String last = oldName.substring(i,oldName.length());
        String s = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
        return s + last;
    }
    
}
